home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_01_05 / 1n04035a < prev    next >
Text File  |  1990-08-18  |  2KB  |  53 lines

  1. ; Listing 4 written for the Phar Lap 386|ASM assembler
  2.  
  3. code      segment  dword public use32
  4.           assume   cs:code        ; set HGSC to VGA mode 
  5.           align    4              ; Copyright 1990 by Gary R. Olhoeft
  6. hstdata   equ      0C7000h        ; C000:7000 
  7. hstctrl   equ      0C7D00h
  8. hstadrl   equ      0C7E00h
  9. hstadrh   equ      0C7F00h
  10.           public   _setvga_    
  11.           public   _setvga        ; function name, no parameters
  12. _setvga_  proc     near
  13. _setvga:  push     ebp            ; save old base page (frame pointer)
  14.           mov      ebp,esp        ; make new frame pointer
  15.           push     es             ; save es
  16.           mov      ax,034h        ; access first Mbyte real memory through LDT
  17.           mov      es,ax          ; es points to first Mbyte real memory
  18.           mov      ax,0D800h      ; set 34010 autoincrement
  19.           mov      es:hstctrl,ax  ; write it to 34010 control register
  20.           mov      ax,0C0h
  21.           mov      es:hstadrl,ax
  22.           mov      ax,600h        ; 0600:00C0 = set osc. (config.1 reg)
  23.           mov      es:hstadrh,ax
  24.           mov      ax,0Ah         ; 1010 = current VGA pixel clock; cmd & overlay
  25.           mov      es:hstdata,ax
  26.           mov      ax,0E0h
  27.           mov      es:hstadrl,ax
  28.           mov      ax,600h        ; 0600:00E0 = write configuration (config.2 reg)
  29.           mov      es:hstadrh,ax
  30.           mov      ax,0Ch         ; 1100 = -h/-v sync, VGA control
  31.           mov      es:hstdata,ax
  32.           mov      dx,3C6h
  33.           mov      ax,4Bh
  34.           out      dx,al          ; port 3C6h, VGA pel mask
  35.           mov      ax,0C0h
  36.           mov      es:hstadrl,ax
  37.           mov      ax,600h        ; 0600:00C0 = set osc.
  38.           mov      es:hstadrh,ax
  39.           mov      ax,2           ; 0010 = current VGA clock, normal color palette
  40.           mov      es:hstdata,ax
  41.           mov      ax,0         
  42.           mov      es:hstadrl,ax
  43.           mov      es:hstadrh,ax  ; set memory address to start
  44.           mov      ax,3
  45.           int      10h            ; video display ah = function 00h, al = mode
  46.           pop      es             ; restore es
  47.           pop      ebp            ; restore base page
  48.           ret                     ; return to caller
  49. _setvga_  endp
  50. code      ends
  51.           end
  52.  
  53.